<?php


/**
 * Notes:
 * PROJECT_NAME : ERP v1.8 重构erp
 * User: 夏鱼儿<397072174@qq.com>
 * Date: 2024/3/26
 * Time: 16:16
 */

namespace app\mini\controller;


use app\admin\model\ConfigMini;
use app\company\model\CompanyRoleMenu;
use app\company\model\StoreUser;
use app\service\base\Controller;
use app\company\model\CompanyUser;
use app\company\model\CompanyMenu;


class Base extends Controller
{

    public function initialize()
    {
        parent::initialize();
        $user_id     = request()->user_id;
        $this->appid = request()->header('appid', '');
        $config = ConfigMini::where('appid', $this->appid)->find();
        if(!$config){
            $this->error('小程序配置不存在');
        }
        $this->company_id = $config->company_id;
        if ($user_id) {
            $this->user_id    = $user_id;
            $this->userInfo   = StoreUser::where('id', $user_id)->find();
//            $this->company_id = $this->userInfo->company_id;
        }
    }


}